<link rel="stylesheet" href="SHOP_CSS/order_detail.css"/>

<div class="order-detail layui-card card-common card-brief">
    <div class="layui-card-header">
        <span class="card-title">订单详情</span>
    </div>
    <div class="order-information order-information-bottom layui-card-body">
        <div class="order-information-contentOne">
            <div class="contentOne-content">
                <div class="contentOne-content-title">交易流水号：</div>
                <div class="contentOne-content-text text-num">{$order_detail['out_trade_no']}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">订单编号：</div>
                <div class="contentOne-content-text">{$order_detail['order_no']}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">订单类型：</div>
                <div class="contentOne-content-text">{$order_detail['order_type_name']}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">订单来源：</div>
                <div class="contentOne-content-text">{$order_detail.order_from_name}</div>
            </div>
            {if $order_detail.pay_status == 1}
            <div class="contentOne-content">
                <div class="contentOne-content-title">付款方式：</div>
                <div class="contentOne-content-text">{$order_detail.pay_type_name}</div>
            </div>
            {/if}
            <div class="contentOne-content">
                <div class="contentOne-content-title">买家：</div>
                <div class="contentOne-content-text">{$order_detail.nickname}</div>
            </div>
        </div>
        <div class="order-information-contentTwo">
            <div class="contentOne-content">
                <div class="contentOne-content-title">配送方式：</div>
                <div class="contentOne-content-text">{$order_detail['delivery_type_name']}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">收货人：</div>
                <div class="contentOne-content-text">{$order_detail['name']}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">联系电话：</div>
                <div class="contentOne-content-text">{$order_detail['mobile']}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">收货地址：</div>
                <div class="contentOne-content-text contentOne-content-text-die">{$order_detail['full_address']}-{$order_detail['address']}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">要求送达时间：</div>
                <div class="contentOne-content-text">{$order_detail['buyer_ask_delivery_time']}</div>
            </div>
            {notempty name="$order_detail.package_list"}
            <div class="contentOne-content">
                <div class="contentOne-content-title">配送员：</div>
                <div class="contentOne-content-text contentOne-content-text-die">{$order_detail.package_list.deliverer}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">配送员联系方式：</div>
                <div class="contentOne-content-text contentOne-content-text-die">{$order_detail.package_list.deliverer_mobile}</div>
            </div>
            {/notempty}
        </div>
        <div class="order-information-contentTwo">
            <div class="contentOne-content">
                <div class="contentOne-content-title">营销活动：</div>
                <div class="contentOne-content-text">{if empty($order_detail['promotion_type_name'])}-{else/}{$order_detail['promotion_type_name']}{/if}</div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">买家留言：</div>
                <div class="contentOne-content-text contentOne-content-text-die">
                    {if $order_detail['buyer_message'] == ""}
                    -
                    {else/}
                    {$order_detail['buyer_message']}
                    {/if}
                </div>
            </div>
            <div class="contentOne-content">
                <div class="contentOne-content-title">备注：</div>
                <div class="contentOne-content-text">
                    {if $order_detail['remark'] == ""}
                    -
                    {else/}
                    {$order_detail['remark']}
                    {/if}
                </div>
            </div>
        </div>
    </div>
    
    <div class="layui-card-header">
        <span class="card-title">订单状态</span>
    </div>
    <div class="order-information-contentOne order-orderStatus-contentOne layui-card-body">
        <div class="contentOne-content">
            <div class="contentOne-content-title">订单状态：</div>
            <div class="contentOne-content-text contentOne-content-textNew">{$order_detail.order_status_name}</div>
        </div>
        <div class="contentTow-operation">
            <div class="contentTow-operation-content bg-color-light-9" onclick="orderRemark('{$order_detail.order_id}')">备注</div>
            {php}
            $order_json_data = json_decode($order_detail['order_status_action'], true);
            $action = $order_json_data['action'];
            {/php}
            {foreach $action as $action_k => $action_item}
                <a class="contentTow-operation-content bg-color-light-9 contentTow-operation-new" href="javascript:orderAction('{$action_item.action}', '{$order_detail.order_id}')">{$action_item.title}</a>
            {/foreach}
        </div>
        <div class="orderStatus">
            <div class="orderStatus-content-title">提醒：</div>
            <div class="orderStatus-content-text">
                <p class="text-tile">买家付款成功后，货款将直接进入您的商户号（微信、支付宝）</p>
                <p class="text-tile">请及时关注你发出的包裹状态，确保可以配送至买家手中</p>
                <p class="text-tile">如果买家表示没收到货或货物有问题，请及时联系买家处理，友好协商</p>
            </div>
        </div>
    </div>

    {if isset($order_detail.form)}
        <!-- 表单信息 -->
        <div class="formFields">
            <div class="layui-card-header">
                <span class="card-title">表单信息</span>
            </div>
            <div class="order-information order-formFields layui-card-body">
                {foreach name="$order_detail.form" item="vo"}
                <div class="contentOne-content">
                    <div class="contentOne-content-title">{$vo.value.title}：</div>
                    <div class="contentOne-content-text">
                    {if !empty($vo.controller) && $vo.controller == 'Img'}
                        {foreach name="$vo.img_lists" item="io"}
                            <div class="form-img">
                                <div class="form-img-wrap">
                                    <img src="{:img($io)}" layer-src>
                                </div>  
                            </div>
                        {/foreach}
                    {else/}
                        {if isset($vo.val)}
                        {$vo.val}
                        {/if}
                    {/if}
                    </div>
                </div>
                {/foreach}
            </div>
        </div>
    {/if}

    {if $order_detail['is_invoice'] == 1}
        <!-- 发票信息 -->
        <div class="formFields">
            <div class="layui-card-header">
                <span class="card-title">发票信息</span>
            </div>
            <div class="order-information order-formFields layui-card-body">
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票类型：</div>
                    <div class="contentOne-content-text">{if $order_detail['invoice_type'] == 1}纸质{else/}电子{/if}{if $order_detail['is_tax_invoice'] == 1}专票{else/}普票{/if}</div>
                </div>
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票抬头：</div>
                    <div class="contentOne-content-text">{$order_detail['invoice_title']}</div>
                </div>
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票抬头类型：</div>
                    <div class="contentOne-content-text">{$order_detail['invoice_title_type'] == 1 ? '个人' : '企业'}</div>
                </div>
                {if $order_detail['invoice_title_type'] == 2}
                <div class="contentOne-content">
                    <div class="contentOne-content-title">纳税人识别号：</div>
                    <div class="contentOne-content-text">{$order_detail['taxpayer_number']}</div>
                </div>
                {/if}
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票内容：</div>
                    <div class="contentOne-content-text">{$order_detail['invoice_content']}</div>
                </div>
                {if $order_detail['invoice_type'] == 1}
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票邮寄地址：</div>
                    <div class="contentOne-content-text">{$order_detail['invoice_full_address']}</div>
                </div>
                {else/}
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票接收邮件：</div>
                    <div class="contentOne-content-text">{$order_detail['invoice_email']}</div>
                </div>
                {/if}
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票费用：</div>
                    <div class="contentOne-content-text">￥{$order_detail.invoice_money}</div>
                </div>
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票税率：</div>
                    <div class="contentOne-content-text">{$order_detail.invoice_rate}%</div>
                </div>
                <div class="contentOne-content">
                    <div class="contentOne-content-title">发票邮寄费用：</div>
                    <div class="contentOne-content-text">￥{$order_detail.invoice_delivery_money}</div>
                </div>
            </div>
        </div>
    {/if}
</div>

<!-- 商品信息、订单操作日志 -->
<div class="shop-information layui-card card-common card-brief">
    <div class="layui-card-header">
        <span class="card-title">商品信息</span>
    </div>
    <div class="shop-information-table layui-card-body">
        <table lay-filter="parse-table-order-product" lay-skin="line">
            <thead>
                <tr class="table-trOne">
                    <th lay-data="{field:'product_name', width:200}">商品</th>
                    <th lay-data="{field:'price'}">价格</th>
                    <th lay-data="{field:'sale_num'}">数量</th>
                    <th lay-data="{field:'total_money'}">小计（元）</th>
                    <th lay-data="{field:'refund_status'}">退款状态</th>
                    <th lay-data="{field:'shipping_status'}">状态</th>
                </tr>
            </thead>
            <tbody>
                {foreach $order_detail['order_goods'] as $list_k => $order_goods_item}
                <tr class="table-trTow">
                    <td>{$order_goods_item.sku_name}</td>
                    <td>{$order_goods_item.price}</td>
                    <td>{$order_goods_item.num}</td>
                    <td>{$order_goods_item.goods_money}</td>
                    <td>
                        {if $order_goods_item.refund_status != 0}
                        <a class="text-color" href='{:href_url("shop/orderrefund/detail?order_goods_id=".$order_goods_item["order_goods_id"])}'>{$order_goods_item.refund_status_name}</a>
                        {/if}
                    </td>
                    <td>{$order_goods_item.delivery_status_name}</td>
                </tr>
                {if isset($order_goods_item.form)}
                <tr>
                    <td colspan="6">
                        <div class="order-goods-form">
                            {foreach name="$order_goods_item.form" item="vo"}
                            <div class="form-item">
                                <div class="field-title">{$vo.value.title}：</div>
                                <div class="field-content">
                                    {if $vo.controller == 'Img'}
                                    {foreach name="$vo.img_lists" item="io"}
                                    <div class="form-img">
                                        <div class="form-img-wrap">
                                            <img src="{:img($io)}" layer-src>
                                        </div>
                                    </div>
                                    {/foreach}
                                    {else/}
                                    {if isset($vo.val)}
                                    {$vo.val}
                                    {/if}
                                    {/if}
                                </div>
                            </div>
                            {/foreach}
                        </div>
                    </td>
                </tr>
                {/if}
                {/foreach}
            </tbody>
        </table>
        <div class="table-trThree table-trFour">
            <div>
                <p>商品总额：<span>￥{$order_detail["goods_money"]}</span></p>
            </div>
            <div>
                <p>店铺优惠卷：<span>￥{$order_detail["coupon_money"]}</span></p>
            </div>
            <div>
                <p>店铺优惠：<span>￥{$order_detail["promotion_money"]}</span></p>
            </div>
            {if $order_detail["point_money"] > 0}
            <div>
                <p>积分抵扣：<span>￥{$order_detail["point_money"]}</span></p>
            </div>
            {/if}
            {if $order_detail["balance_money"] > 0}
            <div>
                <p>余额：<span>￥{$order_detail["balance_money"]}</span></p>
            </div>
            {/if}
            <div>
                <p>订单调价：<span>￥{$order_detail["adjust_money"]}</span></p>
            </div>
            <div>
                <p>配送费用：<span>￥{$order_detail["delivery_money"]}</span></p>
            </div>
            <div>
                <p>发票费用：<span>￥{$order_detail["invoice_money"]}</span></p>
            </div>
            <div>
                <p>发票邮寄费用：<span>￥{$order_detail["invoice_delivery_money"]}</span></p>
            </div>
            {if $order_detail["member_card_money"] > 0}
            <div>
                <p>会员卡：<span>￥{$order_detail["member_card_money"]}</span></p>
            </div>
            {/if}
        </div>
        <div class="table-settlement">
            订单共<span>{$order_detail["goods_num"]}</span>件商品,共计<span>￥{$order_detail["order_money"]}</span>
        </div>
    </div>
</div>

{notempty name="$order_detail.order_log"}
<!-- 订单操作 -->
<div class="shop-operation layui-card card-common card-brief">
    <div class="layui-card-header">
        <span class="card-title">订单操作日志</span>
    </div>
    <div class="shop-operation-time layui-card-body">
        <ul class="layui-timeline">
            {foreach name="$order_detail.order_log" item="vo"}
            <li class="layui-timeline-item">
                <div class="layui-time-left">
                    <p>{:date('Y-m-d', $vo.action_time)}</p>
                    <p>{:date('H:i:s', $vo.action_time)}</p>
                </div>
                <div class="layui-icon layui-timeline-axis">
                    <span class="layui-icon-center"></span>
                </div>
                <div class="layui-timeline-content layui-text">
                    <div class="layui-timeline-title">{$vo.action}</div>
                </div>
            </li>
            {/foreach}
        </ul>
    </div>
</div>
{/notempty}

{include file="order/order_common_action" /}

{include file="order/order_action" /}
<!-- 发货 -->
{include file="order/order_delivery_local_action" /}